package com.sebklebes.radar.converter;

/**
 * @author Ioana Sebestyen
 */
public class RadarEntity {

	private Long id;
	private Double latitude;
	private Double longitude;
	private Double distance;

	public RadarEntity(Long id, Double latitude, Double longitude) {
		this.id = id;
		this.latitude = latitude;
		this.longitude = longitude;
	}

	public RadarEntity(Long id, Double distance) {
		this.id = id;
		this.distance = distance;
	}

	@Override
	public String toString() {
		return " - Radar #" +
				+ id +
				",  ~ " + (int) Math.ceil(distance) +
				" m";
	}

	@Override
	public boolean equals(Object o) {
		if (this == o) return true;
		if (o == null || getClass() != o.getClass()) return false;

		RadarEntity that = (RadarEntity) o;

		if (id != null ? !id.equals(that.id) : that.id != null) return false;

		return true;
	}

	@Override
	public int hashCode() {
		return id != null ? id.hashCode() : 0;
	}
}
